﻿using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace GioHangViet.Models
{
    public class UserOnline
    {
        [Key]
        [StringLength(50, ErrorMessageResourceName = "ErrorUserSecretKeyLength", ErrorMessageResourceType = typeof(Resources.Error))]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayUserSecretKey")]
        public string SecretKey { get; set; }

        [Required(ErrorMessageResourceType = typeof(Resources.Error), ErrorMessageResourceName = "ErrorUserUserName")]
        [StringLength(30, ErrorMessageResourceType = typeof(Resources.Error), ErrorMessageResourceName = "ErrorUserUserNameLength")]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayUserUserName")]
        public string UserName { get; set; }
        
        /// <summary>
        /// mặc định là 0 nghĩa là người dùng thông thường.
        /// </summary>
        [DefaultValue(0)]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayUserGroupId")]
        public Int16 GroupId { get; set; }

        [Required(ErrorMessageResourceName = "ErrorUserLastestLogon", ErrorMessageResourceType = typeof(Resources.Error))]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayUserLastestLogon")]
        public DateTime LastestLogon { get; set; }

        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayOrderId")]
        public int OrderId { get; set; }

        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayUserCreateDate")]
        public DateTime CreateDate { get; set; }

        [DefaultValue(false)]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayUserAllwayLogon")]
        public bool AllwayLogon { get; set; }

        [Required(ErrorMessageResourceName = "ErrorUserOnlineIp", ErrorMessageResourceType = typeof(Resources.Error))]
        [StringLength(20, ErrorMessageResourceName = "ErrorUserOnlineIpLength", ErrorMessageResourceType = typeof(Resources.Error))]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayUserOnlineIp")]
        public string Ip { get; set; }
    }
}